package net.yihang.controller;

import net.yihang.service.PersonService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class PersonController {
    private PersonService personService;

    public PersonController(PersonService personService) {
        this.personService = personService;
    }

    @RequestMapping("/stat/bar/groupBySex")
    public Map<String, Object> groupBySexBar() {
        return personService.groupBySexBar();
    }

    @RequestMapping("/stat/pie/groupBySex")
    public List<Map<String, Object>> groupBySexPie() {
        return personService.groupBySexPie();
    }

    @RequestMapping("/stat/line/showForcesAndAge")
    public Map<String, Object> showForcesAndAge() {
        return personService.showForcesAndAge();
    }

    @RequestMapping("/stat/pie/countByLocation1")
    public List<Map<String, Object>> countByLocation1() {
        return personService.countByLocation1();
    }

    @RequestMapping("/stat/pie/countByLocation2")
    public List<Map<String, Object>> countByLocation2() {
        return personService.countByLocation2();
    }

    @RequestMapping("stat/scatter/timeForceAndAge")
    public List<Object[]> timeForceAndAge(){
        return personService.timeForceAndAge();
    }

    @RequestMapping("stat/scatter/maxForceOrAge")
    public List<Object[]> maxForceOrAge(){
        return personService.maxForceOrAge();
    }

}
